// 读取 n 阶整形方阵 A、B，计算并输出 A*B（每个整数占 10 位，左侧补空格）
#include <stdio.h>

int main(void)
{
    int n;
    if (scanf("%d", &n) != 1) {
        return 0;
    }
    if (n < 1 || n > 10) {
        // 越界不输出
        return 0;
    }

    int A[10][10];
    int B[10][10];
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if (scanf("%d", &A[i][j]) != 1) return 0;
        }
    }
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if (scanf("%d", &B[i][j]) != 1) return 0;
        }
    }

    long long C[10][10];
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            long long s = 0;
            for (int k = 0; k < n; ++k) {
                s += (long long)A[i][k] * (long long)B[k][j];
            }
            C[i][j] = s;
        }
    }

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            printf("%10lld", C[i][j]);
        }
        if (i < n - 1) printf("\n");
    }
    return 0;
}